<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../js/one.js"></script>
</head>
<body onload="time_start()">
    <!--使用函数来构造对象-->
    <script>
        function person(fname, lname, age, eyecolor)
        {
            this.fname = fname;
            this.lname = lname;
            this.age = age;
            this.eyecolor = eyecolor;
        }

        one = new person("xiaowanzi", "hehui", 78, "blue");
        document.write(one.fname + "is" + one.age + " year old. ");
    </script>

    <br>
    <script>
        var date_time = new Date();
        document.write(date_time + "<br>");
        document.write(date_time.getTime() + "毫秒" + "<br>");

        date_time.setFullYear(2022, 3, 12);
        document.write(date_time + "<br>");

        date_time = new Date();
        document.write(date_time.getDay() + "<br>");
    </script>

    <script>
        <!--采用一个定时器-->
        function time_start()
        {
            var today = new Date();
            var h = today.getHours();
            var m = today.getMinutes();
            var s = today.getSeconds();

            m = check_time(m);
            s = check_time(s);

            document.getElementById('time_txt').innerHTML = h + ":" + m + ":" + s;
            t = setTimeout('time_start()', 500);
        }
    </script>
    <div id="time_txt"></div>

    <script>
        var arr = new Array(3);
        arr[0] = "George";
        arr[1] = "John";
        arr[2] = "Thomas";

        document.write(arr.join());
        document.write("<br>");
        document.write(arr.join(":"));
    </script>

    <br>
    <script>
        var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
        var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
        document.write("宽：" + w + "; 高：" + h + "<br>");
        window.resizeTo(w/2, h/2);
//        window.close();
    </script>

    <br>
    <script>
        document.write("可用宽度：" + screen.availWidth + "<br>");
        document.write("可用高度：" + screen.availHeight + "<br>");
    </script>

    <br>
    <script>
        document.write(location.hostname + "<br>");
        document.write(location.pathname + "<br>");
        document.write(location.port + "<br>");
        document.write(location.protocol + "<br>");

        document.write(location.href + "<br>");
    </script>

    <script>
        function newDoc()
        {
            window.location.assign("http://www.w3school.com.cn");
        }
    </script>
    <input type="button" value="加载新文档" onclick="newDoc()">

    <div id="example"></div>
    <script>
        txt = "<p>Browser CodeName: " + window.navigator.appCodeName + "</p>";
        txt += "<p>Browser Name: " + window.navigator.appName + "</p>";
        txt += "<p>Browser Version: " + window.navigator.appVersion + "</p>";
        txt += "<p>Cookies Enabled: " + window.navigator.cookieEnabled + "</p>";
        txt += "<p>Platform: " + window.navigator.platform + "</p>";
        txt += "<p>User-agent header: " + window.navigator.userAgent + "</p>";
        txt += "<p>User-agent language: " + window.navigator.systemLanguage + "</p>";

        document.getElementById("example").innerHTML = txt;
    </script>
</body>
</html>